<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>注册</title>
    <link
      rel="stylesheet"
      href="http://at.alicdn.com/t/c/font_4003170_wlm5erjcnm.css"
    />
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      a {
        text-decoration: none;
      }
      li {
        list-style: none;
      }
      header {
        position: relative;
      }
      header img {
        width: 140px;
        height: 60px;
        margin: 20px 10px 0 300px;
        float: left;
      }
      header span {
        width: 2px;
        height: 50px;
        background-color: #cccccc;
        display: block;
        float: left;
        border-radius: 1px;
        margin: 25px 0 0 0;
      }
      header .li1 {
        float: left;
        margin: 28px 0 0 10px;
      }
      header li p {
        font-weight: 700;
      }
      header li .p1 {
        color: #e10303;
      }
      header .p2 {
        color: #cccccc;
        font-size: 12px;
        float: left;
        margin: 50px 10px 0 400px;
      }
      header .a1 {
        color: #2b5beb;
        font-size: 12px;
        float: left;
        margin: 50px 10px 10px;
      }
      ul {
        width: 80px;
        height: 20px;
        margin-top: 50px;
        float: left;
        position: relative;
        overflow: hidden;
      }
      header ul:hover {
        overflow: visible;
      }
      header ul:hover li {
        border-left: 1px solid #ccc;
        border-right: 1px solid #ccc;
        border-bottom: 1px dotted #ccc;
      }
      header ul:hover .first {
        border-top: 1px solid #ccc;
      }
      ul li {
        width: 80px;
        height: 20px;
        background-color: #fff;
        position: relative;
        z-index: 1;
        padding: 0 0 0 7px;
        box-sizing: border-box;
        border: none;
      }

      ul .last {
        border-bottom: 1px solid #ccc;
      }
      ul li a {
        display: block;
        font-size: 12px;
        line-height: 20px;
        color: #000;
      }
      ul #anniu {
        font-size: 20px;
        position: absolute;
        top: 0px;
        right: 4px;
        z-index: 2;
      }
      /* 划过出现下划线 */
      .xiahuaxian:hover {
        text-decoration: underline;
      }
      /* 轮播图 */
      nav {
        width: 100%;
        height: 600px;
        margin: 10px 0 0 0;
        float: left;
        background: url(../images/注册.jpg) repeat-x;
      }
      nav div {
        width: 900px;
        height: 480px;
        background-color: #fff;
        margin: 90px auto;
        box-sizing: border-box;
        padding: 100px 0 0 0;
        box-shadow: 2px 2px 12px 1px #363131;
      }
      nav div li {
        text-align: center;
        margin-top: 20px;
        vertical-align: middle;
        float: left;
      }
      nav div li span {
        width: 70px;
        background-color: #fff;
        text-align: right;
        color: #ccc;
        float: left;
        margin: 0 10px 0 220px;
        line-height: 42px;
      }
      nav div li .iconfont {
        width: 40px;
        height: 40px;
        border: 1px solid #ccc;
        border-right: none;
        border-left: 1px solid #ccc;
        float: left;
        text-align: center;
        line-height: 40px;
        color: #ccc;
        font-size: 20px;
      }
      nav div li input {
        width: 300px;
        height: 40px;
        outline: none;
        border: 1px solid #ccc;
        border-left: none;
        float: left;
      }
      nav div li .btn {
        background-color: red;
        color: #fff;
        font-size: 18px;
        border: none;
        width: 342px;
        height: 44px;
        border-radius: 1px;
        margin: 0 0 0 299px;
      }
      /* 尾部标签 */
      footer {
        float: left;
        width: 100%;
        height: 200px;
        background-color: #eee;
        box-sizing: border-box;
        padding: 50px 0 0 0;
      }
      footer div {
        text-align: center;
        font-size: 12px;
        margin-top: 40px;
      }
      footer div a {
        color: #ccc;
      }
      footer div .a1:hover {
        color: #e10303;
        text-decoration: underline;
      }
      footer div .a2:hover {
        color: #e10303;
      }
      footer div a img {
        display: inline-block;
        width: 12px;
        height: 12px;
      }
      footer p {
        font-size: 12px;
        color: #e10303;
        text-align: center;
        line-height: 40px;
      }
    </style>
  </head>
  <body>
    <header>
      <img src="../images/left.jpg" alt="" />
      <span></span>
      <li class="li1">
        <p class="p1">买真酒</p>
        <p>就上酒仙</p>
      </li>
      <p class="p2">欢迎来到酒仙网!</p>
      <a class="a1" href="">免费注册</a>
      <ul>
        <li class="first">
          <a href="">帮助中心</a>
        </li>
        <li><a href="">配送说明</a></li>
        <li><a href="">支付方式</a></li>
        <li><a href="">售后服务</a></li>
        <li class="last"><a href="">企业客户</a></li>
        <a id="anniu" class="iconfont icon-xialaanniu" href=""></a>
      </ul>
    </header>
    <nav>
      <div>
        <li>
          <span>用户名</span>
          <b class="iconfont icon-jurassic_user"></b>
          <input type="text" />
        </li>

        <li>
          <span>昵称</span><b class="iconfont icon-jurassic_user"></b
          ><input type="text" />
        </li>
        <li>
          <span>密码</span><b class="iconfont icon-mima"></b
          ><input type="password" />
        </li>
        <li>
          <span>确认密码</span><b class="iconfont icon-mima"></b
          ><input type="password" />
        </li>
        <li></li>
        <li>
          <input type="button" value="立即注册" class="btn" />
        </li>
      </div>
    </nav>
    <footer>
      <div>
        <span>© 酒仙网 2011 jiuxian.com All Rights Reserved</span>　
        <a class="a1" href="">京ICP备17043395号</a>　
        <a class="a2" href=""
          ><img src="../images/警徽.jpg" alt="" /> 京公网安备
          11030102010047号</a
        >
      </div>
      <p>
        购买前请确认达到法定饮酒年龄！酒仙网不销售任何含酒精产品给18岁以下人士！
      </p>
    </footer>
    <script src="../js/01ajax.js"></script>
    <script>
      // 地址
      let baseUrl = "http://localhost:8888";
      // 获取所有的input标签
      let aInputs = document.querySelectorAll("input");
      // 给最后一个input标签添加点击事件
      aInputs[aInputs.length - 1].onclick = function () {
        // 向接口传送数据：
        let params = {
          username: aInputs[0].value,
          nickname: aInputs[1].value,
          password: aInputs[2].value,
          rpassword: aInputs[3].value,
        };

        // 调用ajax函数：
        ajax({
          url: baseUrl + "/users/register",
          type: "post",
          params,
          fn(resData) {
            resData = JSON.parse(resData);
            console.log(resData.code);
            if (resData.code == 0) {
              alert("注册失败");
            }
            if (resData.code == 1) {
              location.href = "02.登录.html";
            }
          },
        });
      };
    </script>
  </body>
</html>
